package com.dnjn.mes.biz.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dnjn.mes.biz.enums.DataType;
import com.dnjn.mes.common.annotation.Excel;
import com.dnjn.mes.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * <p>
 * 异常编码表
 * </p>
 *
 * @author Amber
 * @since 2023-07-27
 */
@Getter
@Setter
@TableName("mes_except")
public class MesExcept extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * PK
     */
    @TableId(value = "except_id", type = IdType.ASSIGN_ID)
    private Long exceptId;

    /**
     * PLC地址
     */
    @Excel(name = "PLC故障地址")
    @NotBlank(message = "PLC故障地址不能为空")
    private String addrPlc;

    /**
     * modbus地址
     */
    @Excel(name = "Modbus故障地址")
    private Integer addrModbus;

    //private Integer byteOffset;
    /**
     * 返回数据类型 BOOL,DWORD
     */
    private DataType dataType;

    @Excel(name = "异常英文")
    @NotBlank(message = "异常英文不能为空")
    private String exceptMessage;

    @Excel(name = "异常中文")
    @NotBlank(message = "异常中文不能为空")
    private String exceptMessageCn;

    private Long equipmentId;

    @NotNull(message = "模块Id不能为空")
    private Long assemblyId;

    /* ext field*/
    @JsonIgnore
    @TableField(exist = false)
    @Excel(name = "机器名")
    private String equipmentName;
    @JsonIgnore
    @Excel(name = "模块名")
    private String assemblyName;

    /**
     * 解决方案
     */
//    @TableField(exist = false)
//    private List<String> descriptions;
    /**
     * 方案id
     */
    @TableField(exist = false)
    private List<MesResolvePlan> planList;

//    private Long workpieceId;
//    @JsonIgnore
//    @Excel(name = "零部件名称")
//    private String workpieceName;
    /**
     * 是否删除|0-否 1-是|valid
     */
    private String deleted;

}
